import { useState } from "react";
import { isFun } from "./utils/helper";
import { Button } from "antd";
import { PlayCircleOutlined } from "@ant-design/icons";

export default function H1() {
  const [value, setValue] = useState<number|null>(()=>null);
  if (isFun(value)) {
    return <div>
      {value}
      <div>
        <Button onClick={() => {
          setValue(1);
        }}>点击</Button>
      </div>
    </div>;
  }
  return <>
    <h1>h{value}</h1>
  <Button icon={<PlayCircleOutlined />} onClick={() => {
          setValue((value)=>value?value+1:1);
        }}>点击</Button>
  </>
}